import request from '@/utils/request'
import {removeToken} from  '@/utils/storage'
import { GET_USER_INFO,LOGOUT } from '../actionTypes'
export const actionUser = () => {
  return async (dispatch) => {
    const res = await request.get('/user/profile')
    // console.log(res, 7766)
    // 发送请求
    dispatch({ type: GET_USER_INFO, payload: res.data })
  }
}

export const actionLogout = () => {
  return async (dispatch) => {
   /* 清除本地缓存 */
    removeToken()
    // 清除redux中的数据
    dispatch({ type: LOGOUT })
  }
}
